<?php

header('Content-Type: text/xml; charset=utf-8', true);
echo '<?xml version="1.0" encoding="utf-8"?'.'>'; 

if (!defined( "APP_DIR" )) {
        define( "APP_DIR", dirname(__FILE__)."/app");
    }

	if (!defined( "ROOT_DIR" )) {
        define( "ROOT_DIR", dirname(__FILE__)."/");
    }
	$configFile = ROOT_DIR . '/config/config.php';
	$fleaFile = ROOT_DIR . '/lib/FLEA/FLEA.php';

	require($fleaFile);
	FLEA::loadAppInf($configFile);
	
	FLEA::import(APP_DIR);   
	$tbAlbum = FLEA::getSingleton('Model_Albums');
	$album = $tbAlbum->findAll(null,'update_date DESC',20);
?>

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
>

<channel>
	<title>Gothicc.com</title>
	<atom:link href="<?php echo FLEA::getAppInf('webAddr');?>/rss2.php" rel="self" type="application/rss+xml" />
	<link><?php echo FLEA::getAppInf('webAddr');?></link>
	<description><?php echo FLEA::getAppInf('webDesc');?></description>
	<generator>snout</generator>
	<webMaster>zcorpse@gmail.com</webMaster>
	<image>
		<url><?php echo FLEA::getAppInf('webAddr');?>/images/logo.jpg</url>
		<title>gothicc.com</title>
		<link><?php echo FLEA::getAppInf('webAddr');?></link>
	</image>
<?php	
	foreach ($album as $rs) {
?>
	<item>
		<title><?php echo $rs['album_name'];?> ~ <?php echo $rs['artists']['artist_name'];?></title>
		<link><?php echo FLEA::getAppInf('webAddr')."/index.php?controller=default";?>&amp;<?php echo "action=view";?>&amp;<?php echo 'id='.$rs['album_id'];?></link>
		<description><![CDATA[<?php echo $rs['album_intro'];?>]]></description>
		<pubDate><?php echo date('r',strtotime($rs['update_date']));?></pubDate>
	</item>
<?php
	}

?>
</channel>
</rss>
